﻿using Basic.FormGatewaryModular.Interface;
using Basic.FormRemoteModel.PhysicalGroup.Model;
using WeDonekRpc.Client;
using WeDonekRpc.Helper.Validate;
using WeDonekRpc.HttpApiGateway;
using WeDonekRpc.HttpApiGateway.Model;

namespace Basic.FormGatewaryModular.Api
{
    internal class PhysicaGroupApi : ApiController
    {
        private readonly IPhysicaGroupService _Service;

        public PhysicaGroupApi ( IPhysicaGroupService service )
        {
            this._Service = service;
        }

        public long Add ( PhysicalGroupSet obj )
        {
            return this._Service.Add(obj);
        }

        public void Delete ( [NumValidate("form.phy.group.id.error", 1)] long id )
        {
            this._Service.Delete(id);
        }

        public PhyGroupData Get ( [NumValidate("form.phy.group.id.error", 1)] long id )
        {
            return this._Service.Get(id);
        }

        public PhyGroupItem[] GetEnables ()
        {
            return this._Service.GetEnables();
        }

        public PagingResult<PhyGroupDto> Query ( PagingParam<PhysicalGroupQuery> query )
        {
            return this._Service.Query(query);
        }

        public bool Set ( LongParam<PhysicalGroupSet> obj )
        {
            return this._Service.Set(obj.Id, obj.Value);
        }
        public void SetIsEnable ( LongParam<bool> obj )
        {
            this._Service.SetIsEnable(obj.Id, obj.Value);
        }
    }
}
